package top.novel.strategy;

import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import top.novel.persistence.PersistenceData;

import javax.swing.*;
import java.util.function.Predicate;

/**
 * @author xuhainan
 * @date 2022/8/12 09:03
 * @region hefei
 */
public interface IStrategy {

    void analyze(JTextPane content, PersistenceData persistenceData);

    default String recallContent(String url) {
        if (StrUtil.isNotBlank(url)) {
            return HttpUtil.get(url);
        }
        return StrUtil.EMPTY;
    }

    String getPrefix();

   default Predicate<String> predicate(){
       return recallUrl -> recallUrl.startsWith(getPrefix());
   }


}
